import { http } from "@/utils/http";
import type { DeliveryPerson } from "types/delivery-person";
import type { PaginationResponse } from "types/flower";

export const getDeliveryPersonPagination = (params: {
  page: number;
  page_size: number;
  kw?: string;
}) => {
  return http.request<PaginationResponse<DeliveryPerson>>(
    "get",
    "/delivery-person",
    {
      params
    }
  );
};

export const createDeliveryPerson = (data: object) => {
  return http.request<DeliveryPerson>("post", "/delivery-person", {
    data
  });
};

export const updateDeliveryPerson = (data: object) => {
  return http.request("put", "/delivery-person", {
    data
  });
};

export const deleteDeliveryPerson = (id: number) => {
  return http.request("delete", "/delivery-person/" + id);
};

export const getAllDeliveryPerson = () => {
  return http.request<DeliveryPerson[]>("get", "/delivery-person/all");
};
